<template>
    <div class="middleBox">
        <div class="wai" v-if="shoplist.length">
            <!-- 店铺列表 -->
            <div class="list" v-for="(item,index) in shoplist" :key="index" >
                <div class="left">
                    <img :src="item.picture" alt="">
                </div>
                <div class="right">
                    <div class="first">汉堡王</div>
                    <div class="second">{{item.name}}</div>
                    <div class="third">爆爆团</div>
                    <div class="force">
                        <span class="price-left">￥<span class="price-right">{{item.min_price}}</span></span>
                    </div>
                    <div class="price-old"><s>￥{{item.min_price}}</s></div>
                    <div class="box">
                        <button @click="changeStatus(item)">{{item.status==0?'马上抢':'已抢完'}}</button>
                        <div class="yishou">{{item.month_saled_content}}</div>
                    </div>
                </div>
            </div>
        </div>
        <!-- 骨架屏 -->
        <van-skeleton v-else title :row="15" />
    </div>
</template>


<script setup>
import { onMounted,ref } from 'vue';
import { user_tuan } from '../../../api'

//数据
var shoplist = ref([])

//方法
//更改任务状态
var changeStatus = (item)=>{    
    item.status = !item.status;
}

//挂载期
onMounted(()=>{
    user_tuan({status:0}).then((res)=>{
            shoplist.value = res.data.list
            // console.log(this.shoplist);
        })
})

</script>

<style scoped>
    .middleBox{
        width: 100%;
        height: 450px;
        overflow: auto;
    }
    .list{
        display: flex;
        box-sizing: border-box;
        padding: 5px;
        position: relative;
        margin-bottom: 10px;
    }
    .left{
        width: 50%;
        background-color: white;
        
    }
    img{
        width: 100%;
        height: 130px;
        border-radius: 10px;
    }
    .right{
        margin-left: 5px;
    }
    .first{
        font-size: 12px;
        color: rgb(78, 76, 76);
        margin-bottom: 5px;
    }
    .second{
        font-size: 16px;
        font-weight: 700;
        margin-bottom: 5px;
    }
    .third{
        color: red;
        font-size: 14px;
        margin-bottom: 5px;
    }
    .fourth{
        display: flex;
        align-items: center;
    }
    .price-left{
        color: red;
        font-size: 12px;
    }
    .price-right{
        font-size: 16px;
        margin-right: 10px;
    }
    .dazhe{
        display: inline-block;
        width: 50px;
        height: 24px;
        border: 1px solid rgb(255, 72, 0);
        color: rgb(255, 72, 0);
        text-align: center;
        line-height: 24px;
    }
    .price-old{
        color: rgb(128, 129, 130);
    }
    .box{
        position: absolute;
        right:10px;
        top:70px
    }
    button{
        width: 70px;
        height: 34px;
        background-color: rgb(244, 62, 62);
        border: none;
        border-radius: 10px;
        margin-left: 5px;
        color:white
    }
    .yishou{
        font-size: 14px;
        color: rgb(255, 72, 0);
        margin-top: 3px;
        margin-left: 13px;
    }
</style>